//1 滚动函数
function scroll(){
	if(window.pageXOffset  !== null){
		return{
			left:window.pageXOffset,
			top:window.pageYOffset
		}
			}
		else if(document.compatMode === 'CSS1Compat'){
			return{
				left: document.documentElement.scrollLeft,
				top:document.documentElement.scrollTop
			}
				}
				return{
					top:document.body.scrollTop,
					left:document.body.scrollLeft
				}
	
}
function $(id){
    return typeof id === "string" ? document.getElementById(id) : null;
}
function show(obj) {
    return obj.style.display = 'block';
}

function hide(obj) {
    return obj.style.display = '';
}
// 通用函数获取屏幕发宽度和高度

function client(){
	if(window.innerWidth){
		return{
			width:window.innerWidth,
			height:window.innerHeight
		}
	}else if(document.compatMode ==='CSS1Compat'){
		return{
			width:document.documentElement.clientWidth,
			height:document.documentElement.clientHeight
		}
	}
	return{
		width:document.body.clientWidth,
		height:document.body.clientHeight
	}
	
}

/*
	//阻止冒泡
	if(event && event.stopPropagation){
					event.stopPropagation();
				}else{
					window.event.cancelBubble = true;
				}*/
				
//基本动画封装
function movex(obj,end ,speed){
	
	clearInterval(obj.timer);
	 obj.timer = setInterval(function(){
		 
		 var len  = obj.offsetLeft > end ? -speed:speed;
		 obj.style.left = obj.offsetLeft + len+'px';
		 
		 if(Math.abs(obj.offsetLeft-end)<Math.abs(len)){
			 clearInterval(obj.timer);
			 obj.style.left =end +'px';
		 }
		 
	 },20);
	
}
//获得css属性兼容函数
function getCSSAttrValue(obj,attr){
	if(obj.currentStyle){
		return obj.currentStyle[attr];
	}else{
		
		return window.getComputedStyle(obj,null)[attr];
	}
	
}